package org.opentcs.kcvehicle.communication.kc.udp.agv.param.function.x14;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.opentcs.kcvehicle.communication.kc.common.byteutils.ByteUtil;

public class RobotSetPosition {
  //机器人 x 坐标 ,8 个字节
  private byte[] robotX;
  //机器人 y 坐标 ,8 个字节
  private byte[] robotY;
  //机器人朝向角度  ,8 个字节
  private byte[] robotAngle;

  public RobotSetPosition(double robotX, double robotY, double robotAngle) {
    this.robotX = ByteUtil.doubleToBytes(robotX);
    this.robotY = ByteUtil.doubleToBytes(robotY);
    this.robotAngle = ByteUtil.doubleToBytes(robotAngle);
  }

  public byte[] toBytes() {
    ByteBuf byteBuf = Unpooled.buffer(24);
    byteBuf.writeBytes(robotX);
    byteBuf.writeBytes(robotY);
    byteBuf.writeBytes(robotAngle);
    return byteBuf.array();
  }
}
